<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    class Phone {
        constructor(name, brand, price) {
            this.name = name;
            this.brand = brand;
            this.price = price;
        }
        call() {
            return `使用${this.name}手机打电话`;
        }
    }

    // 类继承 关键字extends
    class SmartPhone extends Phone {
        constructor(name, brand, price, os) {
            // super表示继承父类的构造函数 
            super(name, brand, price);
            this.os = os;
        }
        // 重写call
        call() {
            return `使用${this.name}手机视频电话`;
        }
        photo() {
            return `${this.name}拍照`
        }
        playGame() {
            return `${this.name}玩游戏`
        }
    }
    const xiaomi = new SmartPhone("小米", "小米", 1999, "android");
    console.log(xiaomi, xiaomi.call(), xiaomi.photo(), xiaomi.playGame());


</script>

</html>